﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework5_6
{
    class Program
    {
        static void Main(string[] args)
        {
            int c;
            int a= int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            c = Math.Min(a, b);

            for (int i = c; i > 0; i = i - 1)
            {
                if (a % i == 0 & b % i == 0)
                {
                    Console.WriteLine(i);
                    break;
                }
            }
            Console.ReadKey();

        }
    }
}
